package com.neutech.neudoc.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.neutech.neudoc.service.DocService;
import com.neutech.neudoc.vo.ToAddCheckVo;
import com.neutech.po.CheckTemplate;
import com.neutech.po.NeuDoc;

@Controller
@RequestMapping(value="/hiswo")
public class DocController {
	@Autowired
	private DocService docService;
	@RequestMapping("/getDocById")
	@ResponseBody
	public NeuDoc getDocById(Integer id){
		NeuDoc doc = docService.getDocById(id);
		return doc;
	}
	@RequestMapping(value="/updateDocById",method=RequestMethod.POST)
	@ResponseBody
	public void updateDocById(){
		docService.updateDocById();
	}
	@RequestMapping("/deleteDocById")
	@ResponseBody
	public void deleteDocById(Integer id){
		docService.deleteDocById(id);
	}
	@RequestMapping("/addDoc")
	@ResponseBody
	public void addDoc(){
		docService.addDoc();
	}
	@RequestMapping(value="/add",method=RequestMethod.POST)
	public String addNewUser(@RequestParam CheckTemplate checkTemplate){
		int result = docService.addCheck(checkTemplate);
		if (result==1) {
			return "seccuss";
		}else {
			return "error";
		}
	}
	@RequestMapping(value="/toadd")
	public ToAddCheckVo toNewUser(){
		return docService.toAddCheck();
		
	}
	
}
